-
Notifications
You must be signed in to change notification settings - Fork 162
Revise type_param delegation
#5505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Actually, I guess we could keep having Though this leaves some odd cases, e.g. |
| # field of rationals (singleton type) | ||
| @register_serialization_type QQField | ||
| # exclude from ring union definition | ||
| type_params(::QQField) = TypeParams(QQField, nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little confused what's happening with QQ now that this has been removed. For example
julia> Oscar.Serialization.type_params(QQ)
Type parameters for QQField ZZ
The printing could be improved... but the point is the return is ZZ and not nothing because of
type_params(R::T) where T <: FracField = TypeParams(T, base_ring(R))
However, QQField still seems to serialize properly including examples when QQField is a parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, there is a catch on line 234 of main.jl
antonydellavecchia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. AbstractAlgebra.Set is useful.
I agree with your remarks about coefficient_ring and we should move away from using base_ring.
Not sure how to deal with type_params for QQField, but it doesn't affect the serialization so this should be good to go.
this ends up being related to my other comment, but the catch I have in main.jl should also take care of this in the same way. |
|
Sorry for the late reply: the difference for |
|
Ah but since you are handling singletons separately perhaps this is already good enough... the only thing I'd worry about is when this is used recursively. So e.g. if I serialize (Crazy idea: perhaps the |
For elements, use type plus parent. For rings, default to just the type.
7db5280 to
710e899
Compare
|
So with new changes we should be able to remove this singleton check on line 234 of main.jl. Latest commits look good |
Roughly use these "rules"
SetElem; plus some others likeSMat), use "type plus parent"I believe these rules are on the long run simpler than what we currently have, and will be easier to document and understand. We should probably also use
coefficient_ringfor more ring types (resp. implement it first for more) -- it is semantic versus the generally unspecified behaviour ofbase_ring, and for a serialization format I believe that we should use the semantic option.So e.g. for
SeriesRingon the long run we should ideally usecoefficient_ringinstead ofbase_ring, but we currently can't. Luckily @SoongNoonien has already been working on this in Nemocas/AbstractAlgebra.jl#2185